<%--
  Created by IntelliJ IDEA.
  User: zhangkeke
  Date: 2022/10/10
  Time: 20:33
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<html>
<head>
    <title>Title</title>
    <script src="${pageContext.request.contextPath}/jcript/jquery-1.7.2.js"></script>
<script>
    $(function (){
        $("#inp1").blur(function (){
            if($("#inp1").val()!=null){
                var reg =/^[\d]{6}$/
                if(!reg.test($("#inp1").val())){
                    $("#inp3").val("密码格式不正确")
                }else {
                    $("#inp2").attr("disabled",false)
                }
            }
        })
        $("#inp1").mouseover(function (){
            $("#inp3").val("")
        })
        $("#inp2").keyup(function (){
            if($("#inp1").val()!=$("#inp2").val()){
                $("#inp3").val("两次密码不一致")
            }else {
                $("#inp3").val("两次密码相同")
                $("#inp3").css("color","green")
            }
        })
        /**注意通过分割http得到电话号，通过下标索引获得,还有建立隐藏域,先通过问号分割，再通过等号分割*/
        var href = location.href; //得到的url字符串
        var s= href.split("?");
        var telephone = s[1].split("=")[1]
        $("#phone").val(telephone);



       /* $("#sub").click(function (){
            if($("#inp1").val()==$("#inp2").val()){
                var password = $("#inp2").val()
                alert(44)

                $.ajax({
                    url:"/setPwd",
                    dataType:"json",
                    data:{"telephone":telephone,password:password},
                    success:function (data){
                        if(data==1){
                            location.href="/pages/userMenu.jsp"
                        }

                    }
                })
            }else {
                location.href="/pages/account/set_password.jsp"
            }

        })*/


    })
</script>
<body>
<div style="position: relative;left: 550px;top: 150px">
    <h3>设置密码</h3>
    <form action="/setPwd">
        <input type="hidden" id="phone"  name="telephone">
        <label>密码</label>
        <input type="password" id="inp1" name="payment_pwd" placeholder="请输入您要设置的密码"><label>提示框</label><input type="text" id="inp3" style="color: red"><br>
        <label>确认密码</label>
        <input type="password" id="inp2" name="payment_pwd" placeholder="请再次确认您的密码">
        <input type="submit" id="sub" value="提交密码">
    </form>
    <a href="/pages/userMenu.jsp">返回首页</a>
</div>




</body>
</html>
